package com.pswv2.backstage.data_management.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pswv2.backstage.data_management.servic.DataManagementService;
import com.pswv2.bub.bsc.dao.po.DataManagement;
import com.pswv2.util.ExtraSpringHibernateTemplate;

@Service
@SuppressWarnings("unchecked")
public class DataManagementServiceImp implements DataManagementService {
	private static Class<?> poc = DataManagement.class;
	@Autowired
	private ExtraSpringHibernateTemplate extraSpringHibernateTemplate;
	@Override
	public void add(DataManagement category) {
		// TODO Auto-generated method stub
		extraSpringHibernateTemplate.getHibernateTemplate().save(category);
	}

	@Override
	public DataManagement queryById(int id) {
		// TODO Auto-generated method stub
		return extraSpringHibernateTemplate.findFirstOneByPropEq(poc, "dataManagementId", id);
	}

	@Override
	public void updata(DataManagement entity) {
		// TODO Auto-generated method stub
		extraSpringHibernateTemplate.getHibernateTemplate().update(entity);
	}
	
	@Override
	public List<DataManagement> queryAll() {
		// TODO Auto-generated method stub
		return (List<DataManagement>) extraSpringHibernateTemplate.findAll(poc);
	}


	@Override
	public DataManagement queryByName(String name) {
		// TODO Auto-generated method stub
		return null;
	}
}
